import apiRequest from './request'
import type { LoginRequest, UserInfo } from '@/types'

// 登录
export const login = (data: LoginRequest): Promise<{ token: string; userInfo: UserInfo }> => {
  return apiRequest.post('/auth/login', data)
}

// 退出登录
export const logout = (): Promise<string> => {
  return apiRequest.post('/auth/logout')
}

// 获取用户信息
export const getUserInfo = (): Promise<UserInfo> => {
  return apiRequest.get('/auth/userinfo')
}